module.exports = app => {
  const DataTypes = app.Sequelize
  const sequelize = app.model
  const attributes = {
    id: {
      type: DataTypes.UUID,
      allowNull: false,
      primaryKey: true,
      defaultValue: DataTypes.UUIDV1,
      comment: '主键 唯一标识'
    },
    username: {
      type: DataTypes.STRING(32),
      comment: '用户名'
    },
    password: {
      type: DataTypes.STRING(32),
      comment: '密码'
    },
    nickname: {
      type: DataTypes.STRING(32),
      comment: '昵称',
      field: 'nickname'
    },
    headIcon: {
      type: DataTypes.STRING(255),
      comment: '头像',
      field: 'head_icon'
    },
    phone: {
      type: DataTypes.STRING(32),
      comment: '手机号'
    },
    email: {
      type: DataTypes.STRING(64),
      comment: '邮箱'
    },
    identify: {
      type: DataTypes.STRING(12),
      comment: '用户身份'
    },
    signature: {
      type: DataTypes.TEXT,
      comment: '签名'
    },
    status: {
      type: DataTypes.STRING(1),
      comment: '用户状态'
    },
    createTime: {
      type: DataTypes.DATE,
      comment: '创建日期',
      field: 'create_time'
    },
    createUser: {
      type: DataTypes.UUID,
      comment: '创建用户',
      field: 'create_user'
    },
    lastTime: {
      type: DataTypes.DATE,
      comment: '修改日期',
      field: 'last_time'
    },
    lastUser: {
      type: DataTypes.UUID,
      comment: '修改用户',
      field: 'last_user'
    },
    deleteFlag: {
      type: DataTypes.BOOLEAN,
      comment: '是否删除（1是，0否）',
      field: 'delete_flag',
      allowNull: false,
      defaultValue: false
    }
  }
  const options = {
    tableName: 'mooc_user'
  }
  const User = sequelize.define('moocUser', attributes, options)
  return User
}
